﻿<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript">
        var targetProtocol = "https:";
        if (window.location.protocol != targetProtocol)
            window.location.href = targetProtocol +
                window.location.href.substring(window.location.protocol.length);
    </script>
    <meta charset="utf-8" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/assets/libs/layui/css/layui.css" />
    <link rel="stylesheet" href="/assets/module/admin.css">
    <link rel="stylesheet" href="/assets/module/autocomplete/autocomplete.css" />
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <title>导航</title>
    <style>
        form {
            padding-top: 50px;
            padding-bottom: 50px;
            background-color: #2F4056;
            width: 100%;
        }

        html, body {
            height: 100%;
        }

        #search_div {
            display: none;
        }

        .layui-layer-page .layui-layer-content {
            overflow: visible !important;
        }
    </style>
</head>
<body>
    <div id="search_div">
        <form action="https://www.baidu.com/baidu" target="_blank" class="layui-row">
            <div class="layui-col-xs8 layui-col-xs-offset1">
                <input type="text" name="wd" id="search-text" placeholder="发现 探索" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-col-xs2 layui-col-xs-offset1">
                <button type="submit" class="layui-btn">
                    <i class="layui-icon layui-icon-search"></i>
                </button>
            </div>
        </form>
    </div>

    <script src="/assets/libs/jquery/jquery-3.2.1.min.js"></script>
    <script src="/assets/libs/layui/layui.js"></script>
    <script>
        layui.config({
            version: 1,
            base: '/assets/module/'
        }).extend({
            autocomplete: 'autocomplete/autocomplete'
        }).use(['autocomplete', 'form', 'layer', 'admin', 'util','setter'], function () {

            var form = layui.form;
            var autocomplete = layui.autocomplete;
            var layer = layui.layer;
            var $ = layui.jquery;
            var admin = layui.admin;
            var util = layui.util;
            var setter = layui.setter;

            layer.ready(function () {
                admin.open({
                    type: 1,
                    closeBtn: 0,
                    shade: 0.3,
                    scrollbar: false,
                    title: '',
                    area: ['600px', '138px'],
                    content: $('#search_div'),
                    success: function () {
                        $('#search-text').focus();
                    }
                });

                layer.msg('更多功能', {
                    offset: 'rb',
                    time: false,
                    closeBtn: false,
                    btn: ['刷新缓存', 'rpgmvp解密','进入后台']
                    , yes: function () {
                        $.post(setter.baseServer() + "/Home/RefreshImageCache", function (d) {
                            if (d.succ) {
                                layer.msg('操作成功', { icon: 1 });
                            } else {
                                layer.msg(d.msg, { icon: 2 });
                            }
                        }, 'json');

                        return false;
                    }, btn2: function (index, layero) {
                        window.open("/RpgMaker/index.html");
                        return false;
                    }, btn3: function (index, layero) {
                        window.open("/page/home.html");
                        return false;
                    }
                });
            });

            // 设置默认主题
            admin.changeTheme('theme-default');

            autocomplete.render({
                elem: $('#search-text')[0],
                url: 'example_request_url',
                template_val: '{{d.q}}',
                template_txt: '{{d.q}}',
                onselect: function (resp) {
                    window.open("https://www.baidu.com/baidu?wd=" + resp.q);
                }
            });

            var device = layui.device();
            var isPC = true;
            if (device.os != "windows") {
                if (device.android || device.ios) {
                    isPC = false;
                } else {
                    isPC = true;
                }
            }

            $(function () {
                $.get(setter.baseServer() + "/HomeManage/Home/GetBackgroundImage", { isPC: isPC }, function (d) {
                    if (d.Tag == 1) {
                        $('body').css("background-image", "url(" + d.Data + ")");
                        $('body').css("background-size", "cover");
                        $('body').css("background-repeat", "no-repeat");
                    } else {
                        layer.msg(d.Message, { icon: 2 });
                    }
                }, 'json');
            })
        });
    </script>
</body>
</html>